#!/usr/bin/python
#
# Definitions for the GOODMAN ITC
#

import numpy as np

def snvSlit(slt):
	return str(slt[:-1])
	
def cnvB(bnn):
	'''
Convert Binning for appropriate template form.
	'''
	return np.int(bnn[:1])

def SetSpecType(choose):
	'''
Choose spectype.
	'''
	
	if choose == 'Spiral galaxy':
		global spiral
		spiral='x'                      # Spiral galaxy
		#return 0
	elif choose == 'Eliptical galaxy':
		global elliptical
		elliptical='x'                  # Eliptical galaxy
		#return 0
	elif choose == 'HII Region':
		global hiireg
		hiireg='x'                      # HII region
		#return 0
	elif choose == 'Planetary Nebulae':
		global pn
		pn='x'                          # Planetary Nebulae
		#return 0
	elif choose == 'Quasar':
		global qso
		qso='x'                         # Quasar
		#return 0
	elif choose == 'Star (LTT3218)':
		global star
		star='x'                       # Star (LTT3218)
		#return 0
	elif choose == 'Blackbody':
		global blackbody
		blackbody='x'                       # Star (LTT3218)
		#return 0
	print '<p> Running with a "', choose, '" spectrum </p>' 
	return 0
	
# Dictionary with input parameters for the ITC
#

form_par = { 'flux' : 16.          ,\
'filter' : 'V'         ,\
'wavlen' : 6563      ,\
'seeing' : 0.9       ,\
'airmass' : 1.24        ,\
'moon' : '20%'         ,\
'grating' : '300'      ,\
'slit' : '3.00'       ,\
'binning' : 2        ,\
'calc' : 'r'           ,\
'signoise' : 25        ,\
'maxsec' : 3600        ,\
'totsec' : 100		,\
'spectype' : 'Star (LTT3218)' ,\
'user_Tbb' : 6000}

#
# Dictionary to convert the input parameters for the apropriate ITC standard
#

form_convert = { 'flux' : np.float          ,\
'filter' : str         ,\
'wavlen' : np.float      ,\
'seeing' : np.float       ,\
'airmass' : np.float        ,\
'moon' : str         ,\
'grating' : str      ,\
'slit' : snvSlit       ,\
'binning' : cnvB        ,\
'calc' : str           ,\
'signoise' : np.float        ,\
'maxsec' : np.float        ,\
'user_Tbb' : np.float	,\
'spectype' : SetSpecType ,\
'totsec' : np.float}


par_title = {'flux' : 'Mag'          ,\
'filter' : 'Filter'         ,\
'wavlen' : 'Lambda'      ,\
'seeing' : 'Seeing'       ,\
'airmass' : 'Airmass'        ,\
'moon' : 'Moon'         ,\
'grating' : 'Grating'      ,\
'slit' : 'Slit'       ,\
'binning' : 'Binning'        ,\
'calc' : 'Choose'           ,\
'signoise' : 'S/N'        ,\
'maxsec' : 'Texp_max'        ,\
'user_Tbb' : 'Tbb'	,\
'totsec' : 'Texp',\
'spectype' : 'SpecType'  }
